<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function foo(name) {
        console.log("foo函数执行:", name);
      }

      function bar() {
        console.log("bar函数执行");
        var name = "kobe";

        function hi() {
          console.log("hi kobe", name);
        }

        foo();
        return hi;
      }

      // debugger
      var fn = bar();
      fn();

      // setTimeout
      setTimeout(function () {
        console.log("匿名执行函数2s后执行");
      }, 2000);

      for (var i = 0; i < 10; i++) {
        console.log(i);
      }
    </script>
  </body>
</html>
